Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Jan 15, 2026

  • Drop ToResultInResults
  • Move its functionality to separate methods in Setup
  • Implement dealias suppression logic for capset arguments.
    This is needed to be able to express referring with fresh to enclosing method types
    that don't immediately have the type containing the fresh as their result type.

Based on #24923

@odersky odersky requested a review from a team as a code owner January 15, 2026 16:30
@odersky odersky changed the title Fix fresh setup Make TypeMaps in Setup work correctly for fresh Jan 15, 2026
@odersky odersky force-pushed the fix-fresh-setup branch 2 times, most recently from 9ac63c6 to b26277c Compare January 19, 2026 13:44
@odersky odersky requested a review from bracevac January 19, 2026 16:26
Also, LocalCaps are no longer described as "fresh" in error messages.
 - Introduce `fresh`

    - New global definition: `caps.fresh`.
    - `fresh` is for ResultCaps in function types.
    - Disallow `fresh` outside result types of function types.

 - Fix isTrackableRef: previously, a static term ref was trackable if its prefix was the ThisType
   of a package, but was not trackable if the prefix was a TermRef to the same package.
   Now both versions are trackable.

 - Don't go to basetypes when comparing dependent functions at cc

 - Improve printing of capabilities:

    - Don't elide a universal capture set in a TypeMismatch message if one of its capabilities is mentioned
      in an error note.
    - Don't elide capture sets containing fresh when printing
    - Don't use the verbose output for fresh if there are no open existentials
    - Systematically backquote all entities shown as capabilities
 - Drop ToResultInResults
 - Move its functionality to separate methods in Setup
 - Implement dealias suppression logic for capset arguments.
   This is needed to be able to express referring with `fresh` to enclosing method types
   that don't immediately have the type containing the `fresh` as their result type.

# Conflicts:
#	tests/neg/i20481.check
|
|Note that capability `fresh` is not included in capture set {}.
|
|where: fresh and outer_fresh refer to a root capability associated with the result type of (s: String): (t: String) -> A^{outer_fresh}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find outer_fresh too mysterious to be understandable by a programmer. Supposedly, it is to convey that the existential is bound in the codomain of the outer (s: String -> ... arrow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. I am not sure what would be a better name, though.

@odersky odersky merged commit 5fc43ef into scala:main Jan 21, 2026
56 checks passed
@odersky odersky deleted the fix-fresh-setup branch January 21, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants